<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<?php
/* 招聘信息添加处理页 */
require_once("../../conn/conn_db.php");   //包含数据库连接文件
if( $_POST["txt_name"]!= "" && $_POST["txt_parentid"]!= "" )  //判断职位名称及所属类别是否为空
{
    $rtid = $_POST["txt_parentid"];    //所属类别编号
    $name = $_POST["txt_name"];      //职位名称
    $city = $_POST["txt_city"];      //工作地区
    $describe = $_POST["txt_describe"];//职位描述
    $createtime = date('Y-m-d'); //发布日期
    
    $sql = "insert into recruit_info (rt_id,r_name,r_city,r_describe,r_createtime,r_status) values($rtid,'$name','$city','$describe','$createtime',1)";
    $insert = $conn->query($sql); //执行SQL语句
    if($insert)                  //判断执行结果
    {
        echo "<script>alert('招聘信息添加成功！');self.location='../recruit_add.php'</script>";
    }
    else
    {
        echo "<script>alert('招聘信息添加失败！');self.location='../recruit_add.php'</script>";
    }
}
else
{
    echo "<script>alert('职位类别和职位名称不能为空！');self.location='../recruit_add.php'</script>";
}
?>
</body>
</html>